home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000070_icon-group-sender _Tue Mar 12 09:28:24 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 12 Mar 1996 12:35:43 MST
  2. Date: Tue, 12 Mar 1996 09:28:24 -0600
  3. From: jeffery@dragon.cs.utsa.edu (Clinton Jeffery)
  4. Message-Id: <9603121528.AA18466@water.cs.utsa.edu>
  5. To: collberg@cs.auckland.ac.nz
  6. Cc: icon-group@cs.arizona.edu
  7. In-Reply-To: <4i2rmk$99b@net.auckland.ac.nz> (collberg@cs.auckland.ac.nz)
  8. Subject: Re: Viewing lots of circles
  9. Content-Length: 1247
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11. Status: O
  12.  
  13. >   From: collberg@cs.auckland.ac.nz (Christian Collberg)
  14. >   I need to speed up a program that prints lots
  15. >   of black and white circles. I'm using
  16. >      WAttrib("fg=white", "fillstyle=solid")  
  17. >   followed by     
  18. >      FillCircle(c*20, l*20, 10)
  19. >
  20. >   Is there a faster way?
  21.  
  22. There are two options to speed this up, and both of them involve eliminating
  23. repeated calls to WAttrib().  Option A is to build a list L of all the white
  24. circles (a list of integers where each set of 3 integers represents a set of
  25. parameters for FillCircle, and then make a single call to WAttrib() to set
  26. the attribute, and then a single call using list invocation: FillCircle ! L
  27.  
  28. Option B is deeper: using Clone() you can set up two or more separate Icon
  29. "window" values that both refer to the same window, but have different colors.
  30. Then you don't have to call WAttrib() to draw a circle in either color:
  31.  
  32. white := Clone(&window, "fg=white", fillstyle=solid")
  33. black := Clone(&window, "fg=black", fillstyle=solid")
  34.  
  35. every i := 1 to 10000 do {
  36.    FillCircle(white, ...)
  37.    FillCircle(black, ...)
  38.    }
  39.  
  40. Clint Jeffery
  41. jeffery@ringer.cs.utsa.edu
  42. Division of Computer Science
  43. The University of Texas at San Antonio
  44. Research http://www.cs.utsa.edu/research/plss.html
  45.